<script type="text/ecmascript-6">
  import Navbar from '../../components/base/navbar.vue';
  import { Cache, cache_keys,setPageTitle } from '../../utils/util';
  export default{
      name:"coupon_gain",
      components:{
          Navbar
      },
      data(){
          return {
              detail:{},
              num:1,
              numCN:'',
              title:''
          }
      },
      methods:{
          jump(page){
              this.$router.push({name:page,params:{index:0}});
          }
      },
      created(){
          let entrance = this.$route.params.entrance;
          if( entrance=='user' ){
            this.detail = Cache.get(cache_keys.sign_gain_coupon);
          }
          if( entrance=='coupon' ){
            this.detail = Cache.get(cache_keys.wx_gain_coupon);
            this.num = this.detail.num;
          }

          const cn = ["零","一","两","三","四","五","六","七","八","九","十"];
          if( this.num<=10 ){
            this.numCN = cn[this.num];
          }else{
            this.numCN = this.num;
          }
          this.title = '获得'+ this.numCN +'张野练PASS';
          setPageTitle(this.title);
      }
  }
</script>
